﻿<%@ Page Title="Khách hàng" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="CustomerManagement.aspx.cs" Inherits="PanasonicWarranty.UI.CustomerManagement"  %>

<%@ Register Src="../UserControl/ucPaging.ascx" TagName="ucPaging" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CssContent" runat="server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            RegisterDialog();
            ComboBox("ddlCateCode");
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid">
                </div>
                <h1>Điều kiện tìm kiếm</h1>
                <div class="clear"></div>
            </div>
            <div class="block-fluid" style="padding: 10px 0px 5px 10px">
                <table width="100%" cellspacing="0" cellpadding="0" class="">
                    <tbody>
                        <tr>
                            <td>Số điện thoại</td>
                            <td><asp:TextBox ID="txtSearchPhone" runat="server" /></td>
                            <td>Nhóm khách hàng</td>
                            <td><asp:DropDownList ID="ddlSearchGroup" runat="server" /></td>
                        </tr>
                    </tbody>
                </table>
                <div style="text-align: center">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click"
                        CssClass="btn" />
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid"></div>
                <h1>Danh mục khách hàng</h1>
                <ul class="buttons">
                    <li>
                        <asp:LinkButton CssClass="isw-plus" ID="lbtnAddNew" runat="server" 
                            onclick="lbtnAddNew_Click" />
                    </li>
                </ul>
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid table-sorting">
                <div class="dataTables_wrapper" id="tSortable_wrapper">
                    <div class="dataTables_length">
                        <label>
                            Hiển thị
                            <asp:DropDownList ID="tSortable_length" size="1" aria-controls="tSortable" runat="server"
                                OnSelectedIndexChanged="tSortable_length_SelectedIndexChanged" AutoPostBack="true">
                                <asp:ListItem Value="5">5</asp:ListItem>
                                <asp:ListItem Value="10">10</asp:ListItem>
                                <asp:ListItem Value="25">25</asp:ListItem>
                                <asp:ListItem Value="50" Selected="True">50</asp:ListItem>
                                <asp:ListItem Value="100">100</asp:ListItem>
                            </asp:DropDownList>
                            dòng</label>
                    </div>
                    <div>
                        <uc1:ucPaging ID="pagingtop" runat="server" />
                    </div>
                    <asp:GridView ID="grvData" CssClass="table2 dataTable" runat="server" 
                        AutoGenerateColumns="false" Width="100%"
                        ShowHeaderWhenEmpty="true" onrowcommand="grvData_RowCommand">
                        <Columns>
                            <asp:TemplateField HeaderText="STT" ItemStyle-CssClass="STT">
                                <ItemTemplate>
                                    <%#(Container.DataItemIndex + 1) + (pagingtop.CurrentPage - 1) * pagingtop.PageSize%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Số điện thoại" DataField="CustomerPhone" />
                            <asp:BoundField HeaderText="Tên khách hàng" DataField="CustomerName" />
                            <asp:BoundField HeaderText="Địa chỉ khách hàng" DataField="Address" />
                            <asp:TemplateField HeaderText="Nhóm khách hàng">
                                <ItemTemplate>
                                    <%# pa_CustomerGroup.GetName(Eval("CustomerGroupID"))%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CheckBoxField HeaderText="Vô hiệu hóa" DataField="Disabled" ItemStyle-CssClass="CheckBox"/>
                            <asp:TemplateField HeaderText="Chức năng" ItemStyle-CssClass="Function">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lbtnEdit" Text="Sửa" runat="server"
                                        CommandName="Editing" CommandArgument='<%#Eval("CustomerPhone")%>' />
                                    &nbsp; &nbsp;
                                    <asp:LinkButton ID="lbtnDelete" Text="Xóa" runat="server"
                                        CommandName="Deleting" CommandArgument='<%#Eval("CustomerPhone")%>' OnClientClick="return confirm('Bạn có chắc chắn muốn xóa không?');" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <div class="dataTables_info" id="tSortable_info">
                        <asp:Literal ID="ltrInfo" runat="server" />
                    </div>
                    <div class="dataTables_paginate paging_full_numbers" id="tSortable_paginate">
                        <uc1:ucPaging ID="pagingbottom" runat="server" />
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
    <div class="dr">
        <span></span>
    </div>
    <div class="dialog" id="dialog1" title="Thông tin khách hàng" style="display: none;">
        <asp:Panel ID="pnlDialogBlock" runat="server" CssClass="block">
            <asp:HiddenField ID="hdfID" Value="" runat="server" />
            <table width="100%" cellpadding="2" cellspacing="2" >
                <tr>
                    <td>Số điện thoại</td>
                    <td><asp:TextBox ID="txtCustomePhone" runat="server" Enabled="false" /></td>
                </tr>
                <tr>
                    <td>Tên khách hàng</td>
                    <td><asp:TextBox ID="txtCustomeName" runat="server" /></td>
                </tr>
                <tr>
                    <td>Địa chỉ</td>
                    <td>
                        <asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine"/>
                    </td>
                </tr>
                <tr>
                    <td>Nhóm khách hàng</td>
                    <td><asp:DropDownList ID="ddlCustomerGroup" runat="server" /></td>
                </tr>
                <tr>
                    <td>Vô hiệu</td>
                    <td><asp:CheckBox ID="chkDisable" runat="server" Checked="false"/></td>
                </tr>
            </table>
            <div style="text-align:center; width:100%; color:Red"><asp:Label ID="lbError" runat="server" /></div>
            <div class="dr"><span></span></div>
            <div style="text-align: right">
                <asp:Button ID="btnSave" CssClass="btn" runat="server" Text="Lưu" 
                    onclick="btnSave_Click" />
                <input type="button" class="btn" value="Đóng" onclick="$('#dialog1').dialog('close'); return false;" />
            </div>
        </asp:Panel>
    </div>
</asp:Content>
